package com.yuma.origin;

public class CloneTest {
    public static void main(String[] args) throws CloneNotSupportedException {
        Dog d = new Dog();
        d.setName("旺财");
        Person person = new Person();
        person.setName("yuma");
        person.setDog(d);

        Person person2 = (Person) person.clone();

        System.out.println("person name:" +person.getName());
        System.out.println("person2 name:" +person2.getName());
        System.out.println("-----------------");
        System.out.println("person addr:" + person);
        System.out.println("person2 addr:" + person2);
        System.out.println("-----------------");
        System.out.println("person.dog name："+person.getDog().getName());
        System.out.println("person2.dog name："+person2.getDog().getName());
        System.out.println("-----------------");
        System.out.println("person.dog addr："+person.getDog());
        System.out.println("person2.dog addr："+person2.getDog());
    }
}
